package com.example.nutritionmanager.profile

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.example.nutritionmanager.R

@Composable
fun ProfileItem(label: String, resourceId: Int, onClick: () -> Unit){
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .padding(top = 8.dp, bottom = 8.dp, start = 10.dp)
            .clickable { onClick() },
        verticalAlignment = Alignment.CenterVertically
    ) {
        Image(
            painter = painterResource(resourceId),
            contentDescription = "餐食图标",
            modifier = Modifier.size(20.dp)
                .padding(horizontal = 0.dp),
        )
        Text(text = label, modifier = Modifier.padding(start = 10.dp))
        Box(
            modifier = Modifier
                .fillMaxWidth().padding(end = 10.dp)
        ) {
            Image(
                painter = painterResource(R.drawable.right_arrow),
                contentDescription = "箭头图标",
                modifier = Modifier.size(25.dp).align(Alignment.CenterEnd)
            )
        }

    }
}